package com.ellen.mac.chatdemo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.widget.ImageView;

import com.ellen.mac.chatdemo.R;
import com.ellen.mac.chatdemo.comment.BaseApp;
import com.squareup.picasso.Picasso;

import java.io.File;


/**
 * Created by Aven on 12/12/12.
 * 图片详情页，聊天时点击图片则会跳转到此页面
 */
public class ImageActivity extends AppCompatActivity {

    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chat_image_brower_layout);
        imageView = findViewById(R.id.imageView);
        Intent intent = getIntent();
        String path = intent.getStringExtra(BaseApp.IMAGE_LOCAL_PATH);
        String url = intent.getStringExtra(BaseApp.IMAGE_URL);
        if (TextUtils.isEmpty(path)) {
            Picasso.with(this).load(url).into(imageView);
        } else {
            Picasso.with(this).load(new File(path)).into(imageView);
        }

    }
}
